﻿using System;
using UnityEngine;
using UnityEngine.UI;

namespace UnityStandardAssets.Utility
{
	// Token: 0x020004E9 RID: 1257
	[RequireComponent(typeof(Text))]
	public class FPSCounter : MonoBehaviour
	{
		// Token: 0x0600195B RID: 6491 RVA: 0x00074F18 File Offset: 0x00073318
		private void Start()
		{
			this.m_FpsNextPeriod = Time.realtimeSinceStartup + 0.5f;
			this.m_Text = base.GetComponent<Text>();
		}

		// Token: 0x0600195C RID: 6492 RVA: 0x00074F38 File Offset: 0x00073338
		private void Update()
		{
			this.m_FpsAccumulator++;
			if (Time.realtimeSinceStartup > this.m_FpsNextPeriod)
			{
				this.m_CurrentFps = (int)((float)this.m_FpsAccumulator / 0.5f);
				this.m_FpsAccumulator = 0;
				this.m_FpsNextPeriod += 0.5f;
				this.m_Text.text = string.Format("{0} FPS", this.m_CurrentFps);
			}
		}

		// Token: 0x04001096 RID: 4246
		private const float fpsMeasurePeriod = 0.5f;

		// Token: 0x04001097 RID: 4247
		private int m_FpsAccumulator;

		// Token: 0x04001098 RID: 4248
		private float m_FpsNextPeriod;

		// Token: 0x04001099 RID: 4249
		private int m_CurrentFps;

		// Token: 0x0400109A RID: 4250
		private const string display = "{0} FPS";

		// Token: 0x0400109B RID: 4251
		private Text m_Text;
	}
}
